Merged
Conversation
sitole
reviewed
Mar 13, 2026
packages/auth/pkg/auth/service.go
Outdated
|
|
||
| //nolint:contextcheck // We use the gin request context to set attributes on the parent span. | ||
| telemetry.SetAttributes(ginCtx.Request.Context(), | ||
| telemetry.WithAPIKey(apiKey), |
Member
There was a problem hiding this comment.
Let's directly call telemetry.WithMaskedAPIKey to make it extra safe.
sitole
reviewed
Mar 13, 2026
packages/auth/pkg/auth/service.go
Outdated
|
|
||
| //nolint:contextcheck // We use the gin request context to set attributes on the parent span. | ||
| telemetry.SetAttributes(ginCtx.Request.Context(), | ||
| telemetry.WithAPIKey(apiKey), |
Member
There was a problem hiding this comment.
Is there a case where you can then easily search for the API key? Does it make sense to also log api key ID?
sitole
requested changes
Mar 13, 2026
sitole
reviewed
Mar 16, 2026
packages/auth/pkg/auth/service.go
Outdated
|
|
||
| //nolint:contextcheck // We use the gin request context to set attributes on the parent span. | ||
| telemetry.SetAttributes(ginCtx.Request.Context(), | ||
| telemetry.WithMaskedAPIKey(apiKey), |
Member
There was a problem hiding this comment.
My point with change from telemetry.WithAPIKey to telemetry.WithMaskedAPIKey to pass already masked value and rename function in way that its ovious from name already. You probably don't want to send a raw api key/auth token to a logging library; it's a different scope that should not ever receive any sensitive values in the first place.
sitole
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Touches authentication validation call paths and logging/telemetry context propagation; mistakes could break auth middleware wiring or leak/misattribute request metadata.
Overview
This PR propagates the
gin.Contextinto auth validation calls so the service can attach masked API keys/access tokens,user.id, andteam.idas OpenTelemetry attributes on the parent request span. It also standardizes proxy request logging by introducinglogger.ProxyRequestFields(including client IP extraction) and adds helpers for masking tokens (keys.MaskToken) plus corresponding logger/telemetry field helpers, with a small generic constraint update to require teams exposeTeamID().Written by Cursor Bugbot for commit 57e6e27. This will update automatically on new commits. Configure here.